import { request } from "@/utils/http"
import { Key } from "react"
import type{ getHosSetListParamsType, getHosSetListReturnType ,addHospitalParamType, getHosSetListItemsType,updateHospitalFromIdParamType} from "./model/hospitalSetTypes"

//获取医院设置列表数据请求
export const getHosSetListRequset = ({page,limit,hosname,hoscode}:getHosSetListParamsType) => {
    return request.get<any,getHosSetListReturnType>(`/admin/hosp/hospitalSet/${page}/${limit}`,{
        params:{
            hosname,
            hoscode
        }
    })
}
//新增医院请求
export const addHospitalRequest = (data:addHospitalParamType) => {
    return request.post<any,null>('/admin/hosp/hospitalSet/save',data)
}

//修改数据中根据Id获取数据请求
export const getHospitalFromIdRequest = (id:string) => {
    return request.get<any,getHosSetListItemsType>(`/admin/hosp/hospitalSet/get/${id}`)
}
//医院设置中 根据id修改数据后，再次提交修改
export const updateHospitalRequest = (data:updateHospitalFromIdParamType) => {
    return request.put<any,null>('/admin/hosp/hospitalSet/update',data)
}

//医院设置中 根据id删除某条数据
export const deleteHosSetFromIdRequest = (id: number) => {
    return request.delete<any, null>(`/admin/hosp/hospitalSet/remove/${id}`)
  }
//医院设置中 批量删除数据
export const batchDeleteHosRequest = (ids:Key[]) => {
    return request.delete<any, null>('/admin/hosp/hospitalSet/batchRemove',{
        data:ids
    })
}